const db = require("../config/database.js");
const userModel = "../schema/user.js";//引入user的表结构
const BookieZila = db.BookieZila;//引入数据库

const User = BookieZila.import(userModel);

const getUserById = async function(id) {
  const userInfo = await User.findOne({
    where : {
      userId: id
    }
  });  
  return userInfo;
}

const getUserByEmail = async function(email) {
  const userInfo = await User.findOne({
    where: {
      userEmail: email
    }
  })
  return userInfo;
};

module.exports = {
  getUserById, getUserByEmail
}